package com.tuniu.agents.tools.hotel;

import com.tuniu.agents.tools.hotel.tool.HotelDetail;
import com.tuniu.agents.tools.hotel.tool.NlowestPriceHotelList;
import com.tuniu.agents.tools.hotel.tool.PlowestPriceHotelList;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Description;

@Configuration
@EnableConfigurationProperties(HotelProperties.class)
@ConditionalOnClass(HotelProperties.class)
@ConditionalOnProperty(prefix = "aigc.agents.tools.hotel", name = "enabled", havingValue = "true")
public class HotelAutoConfiguration {

    @Bean(HotelDetail.TOOLNAME)
    @ConditionalOnMissingBean
    @Description("酒店详情查询，当用户指定查询第几个酒店或给出明确的酒店名称时，结合上文获取酒店名称并调用工具。")
    @Tool(returnDirect = true)
    public HotelDetail hotelDetail(HotelProperties properties) {
        return new HotelDetail(properties);
    }

    @Bean(NlowestPriceHotelList.TOOLNAME)
    @ConditionalOnMissingBean
    @Description("Search hotels in a specified city or near a chosen location")
    @Tool(returnDirect = true)
    public NlowestPriceHotelList nlowestPriceHotelList(HotelProperties properties) {
        return new NlowestPriceHotelList(properties);
    }

    @Bean(PlowestPriceHotelList.TOOLNAME)
    @ConditionalOnMissingBean
    @Description("Search hotels package（Call this tool when users：1.Ask for family-friendly stays with bundled services (meals, tickets);2.Compare standalone hotels vs. \"hotel + X\" packages.")
    @Tool(returnDirect = true)
    public PlowestPriceHotelList plowestPriceHotelList(HotelProperties properties) {
        return new PlowestPriceHotelList(properties);
    }


}
